﻿using System;
using System.Text;
using System.Linq;
using System.Collections.Generic;

namespace Cratos.Generator
{
	/// <summary>
	/// MVP CRUD Presenter class
	/// </summary>
	/// <typeparam name="T"></typeparam>
	public class MVPCrudPresenter<T> : MVPPresenter<T>
	{
		#region Class Constant declarations
		#endregion

		#region Class Event declarations
		#endregion

		#region Class Variable declarations
		private bool m_CanCreate	= false;
		private bool m_CanModify	= false;
		private bool m_CanDelete	= false;
		private bool m_IsInEdit		= false;
		#endregion

		#region Class Constructors & Destructors
		/// <summary>
		/// Class Constructor
		/// </summary>
		public MVPCrudPresenter(T appView) : base(appView) { }
		
		/// <summary>
		/// Class Constructor
		/// </summary>
		public MVPCrudPresenter(T appView, string viewHeader) : base(appView, viewHeader) { }
		#endregion

		#region Class Properties
		/// <summary>
		/// Can Create indicator
		/// </summary>
		public virtual bool CanCreate
		{
			get { return (this.m_CanCreate); }
			set { this.m_CanCreate = value; this.OnNotifyPropertyChanged("CanCreate"); }
		}

		/// <summary>
		/// Can Modify indicator
		/// </summary>
		public virtual bool CanModify
		{
			get { return (this.m_CanModify); }
			set { this.m_CanModify = value; this.OnNotifyPropertyChanged("CanModify"); }
		}

		/// <summary>
		/// Can Delete indicator
		/// </summary>
		public virtual bool CanDelete
		{
			get { return (this.m_CanDelete); }
			set { this.m_CanDelete = value; this.OnNotifyPropertyChanged("CanDelete"); }
		}

		/// <summary>
		/// Is In Edit indicator
		/// </summary>
		public virtual bool IsInEdit
		{
			get { return (this.m_IsInEdit); }
			set
			{
				this.m_IsInEdit = value;
				this.CanCreate	= !this.m_IsInEdit;
				this.CanModify	= !this.m_IsInEdit;
				this.CanDelete	= !this.m_IsInEdit;

				this.OnNotifyPropertyChanged("IsInEdit");
			}
		}
		#endregion

		#region Class Methods
		#endregion

		#region Class Support Methods
		#endregion
	}
}
